{extend name="base"/}
{block name="resources"}
<style>
    .ns-shop-account-block {
        display: flex;
        justify-content: space-between;
    }

    .ns-shop-account {
        width: 30%;
        text-align: center;
        padding: 20px 0;
    }

    .ns-shop-account-num {
        font-size: 20px;
        font-weight: 600;
        margin-bottom: 10px;
    }

    .ns-shop-account-name {
        font-size: 18px;
    }

    .layui-tab-content {
        padding: 10px 0;
    }

    .ns-function-search .layui-form .ns-order-calc .layui-btn {
        position: initial;
        border-right: 1px solid #e5e5e5;
    }

</style>
{/block}
{block name="main"}
<div class="ns-single-filter-box">
    <div class="layui-form">
        <div class="layui-input-inline">
            <input type="text" name="site_name" placeholder="店铺名称" autocomplete="off" class="layui-input">
            <button type="button" class="layui-btn layui-btn-primary" lay-filter="search" lay-submit>
                <i class="layui-icon">&#xe615;</i>
            </button>
        </div>
    </div>
</div>

<table id="account_list" lay-filter="account_list"></table>

<!--操作-->
<script type="text/html" id="action">
	<div class="ns-table-btn">
    <a href="javascript:;" class="layui-btn" lay-event="basic">查看</a>
	</div>
</script>
{/block}
{block name="script"}
<script>
    layui.use(['form', 'laydate'], function() {
        var tableAccountList= layui.table,
            laydate = layui.laydate,
            form = layui.form;
        form.render();

        //渲染时间
        laydate.render({
            elem: '#start_time',
            type: 'datetime'
        });

        laydate.render({
            elem: '#end_time',
            type: 'datetime'
        });

        /**
         * 搜索功能
         */
        form.on('submit(search)', function(data) {
            tableAccountList.reload({
                page: {
                    curr: 1
                },
                where: data.field
            });
            return false;
        });

        //账户流水
        tableAccountList = new Table({
            elem: '#account_list',
            url: ns.url("admin/account/shopbalance"),
            cols: [
                [{
                    field: 'site_name',
                    title: '店铺',
                    width: '15%',
                    unresize: 'false'
                }, {
                    field: 'account',
                    title: '账户余额',
                    width: '10%',
                    unresize: 'false'
                }, {
                    field: 'account_withdraw',
                    title: '已提现',
                    width: '10%',
                    unresize: 'false'
                }, {
                    field: 'account_withdraw_apply',
                    title: '提现中',
                    width: '10%',
                    unresize: 'false'
                }, {
                    field: 'shop_baozhrmb',
                    title: '保证金',
                    width: '8%',
                    templet: '#status',
                    unresize: 'false'
                }, {
                    title: '操作',
                    width: '10%',
                    toolbar: '#action',
                    align: 'left',
                    unresize: 'false'
                }]
            ]
        });

        /**
         * 监听工具栏操作
         */
        tableAccountList.tool(function(obj) {
            var data = obj.data,
                event = obj.event;
            switch (obj.event) {
                case 'basic': //查看
                    location.href = ns.url("admin/shop/accountinfo?site_id=" + data.site_id)
                    break;
            }
        })
    })
</script>
{/block}